package com.tieto;

import java.util.List;

import javax.persistence.Persistence;

import org.junit.Before;

public class PersonTestDerbyEmbedded extends PersonTest {
	@Before
	@SuppressWarnings("unchecked")
	public void setUp() {
		factory = Persistence.createEntityManagerFactory("DerbyEmbedded");
		entityManager = factory.createEntityManager();
		// clear table
		final List<Person> list = entityManager.createQuery(
				"select p from Person p").getResultList();
		entityManager.getTransaction().begin();
		for (Person current : list) {
			entityManager.remove(current);
		}
		entityManager.getTransaction().commit();
	}

}
